package com.huawei.M01.iterator;

import java.util.concurrent.TimeUnit;

public class ThreadDemo{
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(()->{
            while (true){

            }
        });

        t1.start();
        TimeUnit.MILLISECONDS.sleep(100);

        t1.interrupt(); // 只是打上标记，并不会结束生命周期

        if (t1.isInterrupted()){
            System.out.println("线程已经被做了标记，可以进行中断处理");

        }
    }
}
